package com.ty.springbootshiro.mapper;



import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ty.springbootshiro.entity.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserMapper extends BaseMapper<User> {

    /**
     * 登录
     * @param usrName
     * @param usrPassword
     * @return
     */
    User login(@Param("usrName") String usrName, @Param("usrPassword")String usrPassword);

    /**
     * 根据用户名查询用户对象
     * @param usrName
     * @return
     */
    User getUserByName(String usrName);

    /**
     * 根据用户名查询用户是否存在（排除指定ID）
     *
     * @param usrName
     * @param usrId
     */
    User getByUsrNameExceptUsrId(String usrName, Long usrId);


    boolean deleteUser(Long usrId);

    Page<User> userPage(@Param("roleId")Long roleId, @Param("usrName") String usrName, Page<User> page);

    int add(User user);

    int del(Long usrId);

    User getUser(Long usrId);

    int upd(User user);

    // 输入明文密码得到密文密码
//    String encryptPassword(Object plaintextPassword) throws IllegalAccessException;


}
